package Interface.lianxi07;
interface  Teacher{
    void teach();
}
class  TeacherA implements Teacher{

    @Override
    public void teach() {
        System.out.println("TecherA teach Java");
    }
}
class TeacherB implements  Teacher{

    @Override
    public void teach() {
        System.out.println("TeacherB teach java");
    }
}
class School{
    public  static Teacher getTeacher(int i){
        if (i==0) {
            return  new TeacherA();
        }else{
            return  new TeacherB();
        }
    }
}
public class TestInterface {
    public static void main(String[] args) {
        Teacher teacher =School.getTeacher(0);
        teacher.teach();
        teacher=School.getTeacher(10);
        teacher.teach();

    }
}
